home *** CD-ROM | disk | FTP | other *** search
/ CDV Software Presents (USA) / CDV Software Presents (USA).bin / demo / bk_demo.exe / DATA.PAK / maps / dessau.lua < prev    next >
Encoding:
Text File  |  2003-01-17  |  10.3 KB  |  444 lines

  1. function TobeDefeated()
  2. -- well, i don't know how to loose in this mission...
  3. end;
  4.  
  5. function ToWin()
  6.     if ( GetIGlobalVar("temp.allies_map.objective.5", 0) == 1) then
  7.  
  8. --        SetDifficultyLevel(1); -- set back to normal
  9.  
  10.         Win(0);
  11.         Suicide();
  12.     end;
  13. end;
  14.  
  15. -- player calls recon plane
  16. function Objective0()
  17.     if ( GetAviationState( 0) == 0) then
  18.         SetIGlobalVar( "temp.allies_map.objective.0", 1);
  19.         ObjectiveChanged(0, 1);
  20.         SwitchWeatherAutomatic(0);
  21.         RunScript( "DeployTanks", 1000);
  22.         RunScript( "RevealArea", 8000);
  23.         RunScript( "CallFighters", 8000);
  24.         RunScript( "RevealObjective1", 40000);
  25.         Suicide();
  26.     else
  27.         AskClient("HighlightControl(20032)");
  28.     end;
  29. end;
  30.  
  31. -- player calls fighters
  32. function Objective1()
  33.     if ( GetIGlobalVar( "temp.obj", 0) == 1) then
  34.         if ( GetAviationState( 0) == 1) then
  35.             SetIGlobalVar( "temp.allies_map.objective.1", 1);
  36.             ObjectiveChanged(1, 1);
  37.  
  38.             RunScript( "EnableAvia2", 40000);
  39.             RunScript( "DestroyPlanes", 30000);
  40.             RunScript( "RevealObjective6", 5000);
  41.             Suicide();
  42.         else
  43.             AskClient("HighlightControl(20031)");
  44.         end;
  45.     end;
  46. end;
  47.  
  48. -- dogfight
  49. function Objective6()
  50.     if ( GetIGlobalVar( "temp.obj", 0) == 1) then
  51.         if ( GetNUnitsInScriptGroup(10000, 1) <= 0) then
  52.             SetIGlobalVar( "temp.allies_map.objective.6", 1);
  53.             ObjectiveChanged(6, 1);
  54.  
  55.             if ( GetIGlobalVar( "temp.allies_map.objective.1", 0) == 0) then
  56.                 SetIGlobalVar( "temp.allies_map.objective.1", 0);
  57.                 ObjectiveChanged(1, 1);
  58.                 KillScript( "Objective1" );
  59.             end;
  60.  
  61.             DisableAviation(1, 1); -- no aviation for AI!
  62.  
  63. --            LandReinforcement(1); -- AA guns
  64.             RunScript( "DeployAAguns", 5000);
  65.             RunScript( "CloseZone", 20000);
  66.             RunScript( "EnableAvia2", 5000);
  67.             RunScript( "RevealObjective2", 10000);
  68.             Suicide();
  69.         end;
  70.     end;
  71. end;
  72.  
  73. -- paradrop scout
  74. function Objective2()
  75.     if ( GetNUnitsInArea(0, "Drop") > 0) then
  76.         SetIGlobalVar( "temp.allies_map.objective.2", 1);
  77.         ObjectiveChanged(2, 1);
  78.  
  79.         RunScript( "PatrolBMW", 25000);
  80.  
  81.         RunScript( "ScoutProblem", 3000);
  82.  
  83.         KillScript( "BlinkParadrop" );
  84.  
  85.         RunScript( "RevealObjective3", 5000);
  86.         Suicide();
  87.     end;
  88. end;
  89.  
  90. -- sneak and eliminate big AAgun crews
  91. function Objective3()
  92. local AAguns1_ScriptID = 1;
  93. --    if ( GetIGlobalVar( "temp.obj", 0) == 3) then
  94.         if ( GetNUnitsInScriptGroup(AAguns1_ScriptID, 1) <= 0) then
  95.             SetIGlobalVar( "temp.allies_map.objective.3", 1);
  96.             ObjectiveChanged(3, 1);
  97.  
  98.             SetGameSpeed(0);
  99.  
  100.             KillScript( "ScoutProblem" );
  101.  
  102.             RunScript( "RevealMap", 5000);
  103.             RunScript( "RevealObjective4", 5000);
  104.             Suicide();
  105.         end;
  106. --    end;
  107. end;
  108.  
  109. -- call bombers and destroy small AAguns
  110. function Objective4()
  111. local AAguns2_ScriptID = 2;
  112.     if ( GetIGlobalVar( "temp.obj", 0) == 4) then
  113.         if (( GetIGlobalVar( "temp.lala1", 0) == 0) and ( GetAviationState( 0) == 3)) then
  114.             RunScript( "EnableAvia4", 40000);
  115.             SetIGlobalVar( "temp.lala1", 1);
  116.         end;
  117.  
  118.         if ( GetNUnitsInScriptGroup(AAguns2_ScriptID, 1) <= 0) then
  119.             SetIGlobalVar( "temp.allies_map.objective.4", 1);
  120.             ObjectiveChanged(4, 1);
  121.  
  122.             KillScript( "BlinkBomber" );
  123.  
  124.             RunScript( "RevealObjective5", 30000);
  125.             Suicide();
  126.         end;
  127.     end;
  128. end;
  129.  
  130. -- call close support and destroy all remaining enemy
  131. function Objective5()
  132. local Enemy = GetNUnitsInScriptGroup(101, 1) + GetNUnitsInScriptGroup(123, 1) + GetNUnitsInScriptGroup(300, 1) + GetNUnitsInScriptGroup(301, 1) + GetNUnitsInScriptGroup(302, 1) +
  133.     GetNUnitsInScriptGroup(303, 1) + GetNUnitsInScriptGroup(304, 1);
  134.     if ( Enemy <= 0) then
  135.         SetIGlobalVar( "temp.allies_map.objective.5", 1);
  136.         ObjectiveChanged(5, 1);
  137.  
  138.         Suicide();
  139.     end;
  140. end;
  141.  
  142. function ScoutProblem()
  143. local paraID = GetIGlobalVar( "ParadropSquad.ScriptID", 0);
  144.     if ( GetNUnitsInScriptGroup( paraID ) <= 0) then
  145.         ObjectiveChanged(7, 0);
  146.         SetIGlobalVar( "ParadropSquad.ScriptID", paraID + 1);
  147.         SetIGlobalVar( "temp.akindofproblem", 7);
  148.         RunScript( "Objective78", 3000);
  149.  
  150.         Suicide();
  151.         return 0;
  152.     end;
  153.     if ( GetNAmmo( paraID) <= 0) then
  154.         ObjectiveChanged(8, 0);
  155.         SetIGlobalVar( "ParadropSquad.ScriptID", paraID + 1);
  156.         SetIGlobalVar( "temp.akindofproblem", 8);
  157.         RunScript( "Objective78", 3000);
  158.  
  159.         Suicide();
  160.         return 0;
  161.     end;
  162. end;
  163.  
  164. function Objective78()
  165.     if ( (GetAviationState( 0) == 2) and ( GetNScriptUnitsInArea( GetIGlobalVar( "ParadropSquad.ScriptID", 0), "Drop") > 0)) then
  166.         ObjectiveChanged( GetIGlobalVar( "temp.akindofproblem", 0), 1);
  167.         RunScript( "ScoutProblem", 3000);
  168.         Suicide();
  169.     end;
  170. end;
  171.  
  172. function EnableAvia2()
  173.     EnableAviation(0, 2); -- enable paradropper
  174.     RunScript( "BlinkParadrop", 4000);
  175.     Suicide();
  176. end;
  177.  
  178. function BlinkParadrop()
  179.     if ( GetAviationState( 0) == 2) then
  180.         Suicide();
  181.     else
  182.         AskClient("HighlightControl(20033)");
  183.     end;
  184. end;
  185.  
  186. function BlinkBomber()
  187.     if ( GetAviationState( 0) == 3) then
  188.         Suicide();
  189.     else
  190.         AskClient("HighlightControl(20030)");
  191.     end;
  192. end;
  193.  
  194. function EnableAvia4()
  195.     EnableAviation(0, 4); -- enable close support
  196.     Suicide();
  197. end;
  198.  
  199. function BlinkCS()
  200.     if ( GetAviationState( 0) == 4) then
  201.         Suicide();
  202.     else
  203.         AskClient("HighlightControl(20035)");
  204.     end;
  205. end;
  206.  
  207.  
  208. function CallFighters()
  209. local ACTION_FIGHTERS = 20;
  210.     EnableAviation(1, 1);
  211.     Cmd(ACTION_FIGHTERS, 10000, 1, 3846 + RandomInt(500), 3846 + RandomInt(500));
  212.     Suicide();
  213. end;
  214.  
  215. function DestroyPlanes()
  216.     if ( GetNUnitsInScriptGroup(10000) > 0) then
  217.         DamageObject( 10000, 0);
  218.     end;
  219.     Suicide();
  220. end;
  221.  
  222. function CloseZone()
  223.     ViewZone("View1", 0);
  224.     Suicide();
  225. end;
  226.  
  227. function DeployAAguns()
  228. local ACTION_DEPLOY = 32;
  229. local ACTION_MOVE = 0;
  230.  
  231.     Cmd(ACTION_DEPLOY, 200, GetObjCoord(200));
  232.     QCmd(ACTION_MOVE, 200, 65*64, 43*64);
  233.  
  234.     Cmd(ACTION_DEPLOY, 201, GetObjCoord(201));
  235.     QCmd(ACTION_MOVE, 201, 63*64, 43*64);
  236.  
  237.     Cmd(ACTION_DEPLOY, 202, GetObjCoord(202));
  238.     QCmd(ACTION_MOVE, 202, 61*64, 43*64);
  239.  
  240.     Cmd(ACTION_DEPLOY, 203, GetObjCoord(203));
  241.     QCmd(ACTION_MOVE, 203, 59*64, 43*64);
  242.  
  243.     Cmd(ACTION_DEPLOY, 204, GetObjCoord(204));
  244.     QCmd(ACTION_MOVE, 204, 56*64, 43*64);
  245.  
  246.     Suicide();
  247. end;
  248.  
  249. function DeployTanks()
  250. local ACTION_MOVE = 0;
  251.  
  252.     Cmd(ACTION_MOVE, 300, 76*64, 82*64);
  253.  
  254.     Cmd(ACTION_MOVE, 301, 76*64, 86*64);
  255.  
  256.     Cmd(ACTION_MOVE, 302, 76*64, 90*64);
  257.  
  258.     Cmd(ACTION_MOVE, 303, 76*64, 94*64);
  259.  
  260.     Cmd(ACTION_MOVE, 304, 76*64, 98*64);
  261.  
  262.     Suicide();
  263. end;
  264.  
  265. function MortarBig_Fire()
  266. local ACTION_SUPPFIRE = 16;
  267.  
  268.     if ( GetNUnitsInScriptGroup(101) > 0) then
  269.         Cmd(ACTION_SUPPFIRE, 101, 28*64, 30*64);
  270.         RunScript( "MortarBig_Fire", RandomInt(5000) + 30000);
  271.     end;
  272.     Suicide();
  273. end;
  274.  
  275. function Mortar_Fire()
  276. local ACTION_SUPPFIRE = 16;
  277. local Points = {{x = 35*64, y = 23*64}, {x = 18*64, y = 29*64}, {x = 27*64, y = 25*64}};
  278. local i = GetIGlobalVar( "temp.points", 0) + 1;
  279.  
  280.     if ( GetNUnitsInScriptGroup(100) > 0) then
  281.         Cmd(ACTION_SUPPFIRE, 100, Points[i].x, Points[i].y);
  282.  
  283.         if (i > 2) then
  284.             i = 0;
  285.         end;
  286.  
  287.         SetIGlobalVar( "temp.points", i);
  288.  
  289.     else Suicide();
  290.     end;
  291. end;
  292.  
  293. function RevealObjective0()
  294.     if ( GetIGlobalVar("temp.allies_map.objective.0", 0) == 0) then
  295.         ObjectiveChanged(0, 0);
  296.     end;
  297.     Suicide();
  298. end;
  299.  
  300. function RevealObjective1()
  301.     if ( GetIGlobalVar("temp.allies_map.objective.1", 0) == 0) then
  302.         SetIGlobalVar( "temp.obj", 1);
  303.         EnableAviation(0, 1);
  304.         ObjectiveChanged(1, 0);
  305.     end;
  306.     Suicide();
  307. end;
  308.  
  309. function RevealObjective2()
  310.     if ( GetIGlobalVar("temp.allies_map.objective.2", 0) == 0) then
  311.         SetIGlobalVar( "temp.obj", 2);
  312.         ObjectiveChanged(2, 0);
  313.     end;
  314.     Suicide();
  315. end;
  316.  
  317. function RevealObjective3()
  318.     if ( GetIGlobalVar("temp.allies_map.objective.3", 0) == 0) then
  319.         SetIGlobalVar( "temp.obj", 3);
  320.         ObjectiveChanged(3, 0);
  321.     end;
  322.     Suicide();
  323. end;
  324.  
  325. function RevealObjective4()
  326.     if ( GetIGlobalVar("temp.allies_map.objective.4", 0) == 0) then
  327.         SetIGlobalVar( "temp.obj", 4);
  328.         EnableAviation(0, 3);
  329.         RunScript( "BlinkBomber", 4000);
  330. --        SetDifficultyLevel(0); -- set easy
  331.         ObjectiveChanged(4, 0);
  332.     end;
  333.     Suicide();
  334. end;
  335.  
  336. function RevealObjective5()
  337.     if ( GetIGlobalVar("temp.allies_map.objective.5", 0) == 0) then
  338.         SetIGlobalVar( "temp.obj", 5);
  339.         RunScript( "BlinkCS", 4000);
  340.         ObjectiveChanged(5, 0);
  341.     end;
  342.     Suicide();
  343. end;
  344.  
  345. function RevealObjective6()
  346.     if ( GetIGlobalVar("temp.allies_map.objective.6", 0) == 0) then
  347.         ObjectiveChanged(6, 0);
  348.     end;
  349.     Suicide();
  350. end;
  351.  
  352. function Presets()
  353.     SwitchWeather( 0);
  354.     SwitchWeatherAutomatic( 0);
  355.  
  356.     DisableAviation(0, 1);
  357.     DisableAviation(0, 2);
  358.     DisableAviation(0, 3);
  359.     DisableAviation(0, 4);
  360.  
  361.     DisableAviation(1, 0);
  362.     DisableAviation(1, 1);
  363.     DisableAviation(1, 2);
  364.     DisableAviation(1, 3);
  365.     DisableAviation(1, 4);
  366.     RunScript( "DamageBridge", 2000);
  367.     SetIGlobalVar( "ParadropSquad.ScriptID", 5000);
  368. end;
  369.  
  370. function RevealArea()
  371.     ViewZone("View1", 1);
  372.     Suicide();
  373. end;
  374.  
  375. function RevealMap()
  376.     ViewZone("AllMap", 1);
  377.     Suicide();
  378. end;
  379.  
  380. function PatrolBMW()
  381. local ACTION_SWARM = 3;
  382. local Points1 = {{x = 2552, y = 6970}, {x = 2600, y = 4700}, {x = 4800, y = 4700}, {x = 4840, y = 7000}};
  383. local i = GetIGlobalVar( "temp.points1", 0) + 1;
  384.  
  385.       Cmd (ACTION_SWARM, 800, Points1[i].x, Points1[i].y );
  386.       if (i > 3) then
  387.     i = 0;
  388.       end;
  389.  
  390.       SetIGlobalVar( "temp.points1", i);
  391. --          RunScript( "PatrolBMW", 10000);
  392.  
  393. end;
  394.  
  395. function DamageBridge()
  396.     DamageObject( 1234, 0);
  397.     Suicide();
  398. end;
  399.  
  400. function Alarm()
  401. local ACTION_SWARM = 3;
  402. local PARADE = 10;
  403. local PARADE_PARAM = 3;
  404.  
  405.     if (GetNUnitsInArea(0, "Alarm") > 0) then
  406. --           Cmd(PARADE, 1111, PARADE_PARAM);
  407.            QCmd(ACTION_SWARM, 1111, 2550, 7000);
  408.            RunScript( "SWARM_SQUAD_1111", 10000 + RandomInt(10000) );
  409.         Suicide();
  410.     end;
  411. end;
  412.  
  413. function SWARM_SQUAD_1111()
  414. local ACTION_SWARM = 3;
  415.     Cmd(ACTION_SWARM, 1111, 310, 7500);
  416.     RunScript( "SWARM_SQUAD1_1111", 50000 + RandomInt(25000));
  417.     Suicide();
  418. end;
  419.  
  420. function SWARM_SQUAD1_1111()
  421. local ACTION_SWARM = 3;
  422.     if (GetNUnitsInArea(0, "Alarm" ) > 0 ) then
  423.         Cmd(ACTION_SWARM, 1111, 3290, 5510);
  424.         Suicide();
  425.     end;
  426. end;
  427.  
  428. function Init()
  429.     RunScript( "ToWin", 4000);
  430. --    RunScript( "TobeDefeated", 4000);
  431.     RunScript( "Objective0", 4000);
  432.     RunScript( "Objective1", 2000);
  433.     RunScript( "Objective2", 2000);
  434.     RunScript( "Objective3", 2000);
  435.     RunScript( "Objective4", 2000);
  436.     RunScript( "Objective5", 2000);
  437.     RunScript( "Objective6", 2000);
  438.     RunScript( "RevealObjective0", 3000);
  439.     RunScript( "MortarBig_Fire", 1000);
  440.     RunScript( "Mortar_Fire", 15000);
  441.     RunScript( "Alarm", 2000);
  442.     Presets();
  443. end;
  444.